package com.huang.common.utils;

import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.RandomUtil;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public class IdGenerator {

    public static long snowflakeId() {
        return IdUtil.getSnowflake(0, 0).nextId();
    }

    public static String objectId() {
        return IdUtil.objectId();
    }

    public static String UUID() {
        return IdUtil.randomUUID();
    }

    public static String simpleUUID() {
        return IdUtil.simpleUUID();
    }

    public static String paymentNo() {
        String now = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"));
        String random = RandomUtil.randomNumbers(8);
        return now + random;
    }
}
